const mongoose = require("mongoose");
const Schema = mongoose.Schema;
const addressSchema = new Schema({
    userId: { type: Schema.Types.ObjectId, ref: 'muser' }, // 用户ID，关联到用户表的ID字段
    name: { type: String, required: true }, // 联系人姓名
    phone: { type: String, required: true }, // 联系人电话
    address: { type: String, required: true }, // 详细地址
    province: { type: String, required: true }, // 省
    city: { type: String, required: true }, // 市
    county: { type: String, required: true }, // 区
    isDefault: { type: Boolean, default: false }, // 是否为默认地址，默认为false
    updateTime: { type: Number, default: Date.now } // 更新时间，默认为当前时间
});
const Address = mongoose.model('address', addressSchema);
module.exports = Address;